var Util = {
    BASE_ADDRESS: "http://www.cdlonline.unimi.it/ssri.2006/",
    LOGOUT_ADDRESS: "http://www.cdlonline.unimi.it/ssri.2006/logout.aspx",
    //	BASE_ADDRESS: "",
    showPopup: function(title, msg, data, listener) {
        try {
            Components.classes["@mozilla.org/alerts-service;1"]
                    .getService(Components.interfaces.nsIAlertsService)
                    .showAlertNotification('chrome://ssriwatcher/skin/universita_on.gif', title, msg, true, data, listener);
        } catch(err) {
            Util.setStatusMessage('Error: ' + err);
        }
    },
    //FIXME deprecato utilizzare il logger
    setStatusMessage: function(msg) {
        document.getElementById('ssriwatcher-label').value = msg;
    },
    html_to_dom_old: function(aHTMLString) {
        var range = document.createRange();
        range.selectNode(document.getElementsByTagName("iframe").item(0));
        var documentFragment = range.createContextualFragment(aHTMLString);
        //document.body.appendChild(documentFragment);

        return documentFragment;
    },
    html_to_dom: function(aHTMLString) {
        debugger;
        var html = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null);
        var body = document.createElementNS("http://www.w3.org/1999/xhtml", "body");
        var div = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
        html.documentElement.appendChild(body);
        body.appendChild(div);

        div.appendChild(Components.classes["@mozilla.org/feed-unescapehtml;1"]
                .getService(Components.interfaces.nsIScriptableUnescapeHTML)
                .parseFragment(aHTMLString, false, null, div));

        return body;
    }
};
